package com.wg.net.client.tcp.operation;

import com.wg.core.io.BigEndianBinaryWriter;
import com.wg.core.io.IBinaryReader;
import com.wg.core.io.IBinaryWriter;
import com.wg.core.io.IBinaryReadable;
import com.wg.core.io.IBinaryWritable;

/**
 * 初始化请求
 *
 * @author 少爷123
 */
public class InitRequest implements IBinaryWritable, IBinaryReadable {
    private String appId;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Override
    public void readBytes(IBinaryReader reader) {
        appId = reader.readString();
    }
    
    @Override
    public byte[] toBytes() {
        IBinaryWriter writer = new BigEndianBinaryWriter(16);
        writer.writeString(appId);
        return writer.toByteArray();
    }
}
